<?php

 
 Zend_Loader::loadClass("BaseDBRows");
 Zend_Loader::loadClass("OrganismAttribute");
 class OrganismAttributes extends BaseDBRows
 {
 	protected function setUp()
 	{
 		$this->_tableName = OrganismAttribute::_tablename;
 	}	
	

	public function getOrganismAttribute($org_organism_id) {
		Zend_Loader::loadClass("OrganizationOrganism");
		Zend_Loader::loadClass("QueryCreator");
		Zend_Loader::loadClass("Size");
		
		$query = new QueryCreator();
		$query->addSelect(" b.organism_attribute_id,c.size,c.size_code ");
		$query->addFrom(OrganizationOrganism::_tablename . " a ");
		$query->addJoin(" LEFT JOIN ". $this->_tableName . " b on a.organism_id = b.organism_id ");
		$query->addJoin(" INNER JOIN ". Size::_tablename . " c on c.size_code = b.size_code"  );
		$query->addWhere(" a.org_organism_id = ". $org_organism_id);
		$query->addOrderBy("c.display_order");
		
		$db = DBCon::instance();
		$result = $db->executeQuery($query->createSQL());
		return $result;
	}	
	
 }
?>